﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JeanFish.Data.Common
{
    public abstract class DbTransaction : System.Data.Common.DbTransaction
    {
        private System.Data.Common.DbTransaction transaction;
        private DbConnection decoratedConnection;

        protected DbTransaction(System.Data.Common.DbTransaction transaction, DbConnection connection)
        {
            this.transaction = transaction;
            this.decoratedConnection = connection;
        }

        public override System.Data.IsolationLevel IsolationLevel
        {
            get { return this.Transaction.IsolationLevel; }
        }

        public System.Data.Common.DbTransaction Transaction
        {
            get { return this.transaction; }
        }

        protected override System.Data.Common.DbConnection DbConnection
        {
            get { return this.decoratedConnection; }
        }

        protected DbConnection DecoratedConnection
        {
            get { return this.decoratedConnection; }
        }
        public override void Commit()
        {
            this.Transaction.Commit();
        }
        public override void Rollback()
        {
            this.Transaction.Rollback();
        }
    }
}
